﻿using System;
using System.Threading.Tasks;
using WalkingTec.Mvvm.Core;
using static System.Reflection.MethodBase;

namespace SelfService.Model
{
    public abstract class BaseTask
    {
        protected WTMContext Context;

        protected BaseTask(WTMContext context)
        {
            Context = context;
        }

        public abstract Task<bool> Process();
        
        /// <summary>
        /// 输出日志
        /// </summary>
        /// <param name="message"></param>
        /// <param name="logType"></param>
        protected void Logger(string message, ActionLogTypesEnum logType)
        {
            var className = this.GetType().Name;
#if DEBUG
            Console.WriteLine($"{DateTime.Now:HH:mm:ss}{message}|{className}");
#endif
            Context.DoLog(message, logType, className);
        }
    }
}
